package hu.raholec.data;

import java.util.ArrayList;
import java.util.Collections;

public class BreadCrumbList extends ArrayList<BreadCrumbElement>{
	@Override
	public boolean add(BreadCrumbElement e) {
		boolean ret = super.add(e);
		Collections.sort(this);
		return ret;
	}
	
	public String toString() {
		String ret = "";
		for (BreadCrumbElement element: this) {
			ret += ( ! ret.isEmpty() ? " / " : "" ) + element.getName() + "=" + element.getPath();
		}
		return ret;
	}
	

}
